package ModelLayer;
import java.io.*;

/**
 * Write a description of class FileHandler here.
 * 
 * @author (ucn-1semprojekt-dm78-gruppe1)
 * @version (a version number or a date)
 */
public class FileHandler
{
  public static void gem(Object obj, String filnavn) throws IOException
  {
    FileOutputStream dataflow = new FileOutputStream(filnavn);
    ObjectOutputStream objektflow = new ObjectOutputStream(dataflow);
    objektflow.writeObject(obj);
    objektflow.close();
  }

  public static Object hent(String filnavn) throws Exception
  {
    FileInputStream dataflow = new FileInputStream(filnavn);
    ObjectInputStream objektflow = new ObjectInputStream(dataflow);
    Object obj = objektflow.readObject();
    objektflow.close();
    return obj;
  }
}